﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:resx="clr-namespace:Anagramme.Resources"
    xmlns:conv="clr-namespace:Anagramme.Converters;assembly=Anagramme.Common"
    xmlns:ctrl="clr-namespace:Anagramme.Controls"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:media="clr-namespace:System.Windows.Media;assembly=PresentationCore"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" 
    mc:Ignorable="d">

    <!--Resources-->
    <resx:ApplicationResources x:Key="Resources" />

    <!--Converters-->
    <conv:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    <conv:NotConverter x:Key="NotConverter" />
	<conv:GameModesToBooleanConverter x:Key="GameModesToBooleanConverter" />
    <conv:GameModesToVisibilityConverter x:Key="GameModesToVisibilityConverter" />

    <!--Fonts-->
    <FontFamily x:Key="NormalFont" >Segoe UI</FontFamily>
    <FontFamily x:Key="LightFont" >Segoe UI Light</FontFamily>
    <FontFamily x:Key="BoldFont" >Segoe UI Bold</FontFamily>
    
    <!--FontSizes-->
    <sys:Double x:Key="TitleSize">21</sys:Double>
    <sys:Double x:Key="SubTitleSize">16</sys:Double>
    <sys:Double x:Key="TextSize">14</sys:Double>
    <sys:Double x:Key="WordTextSize">21</sys:Double>
    <sys:Double x:Key="PlayerTextSize">16</sys:Double>
    <sys:Double x:Key="ResultTextSize">24</sys:Double>
    <sys:Double x:Key="ButtonTextSize">16</sys:Double>
    
    <!--Colors-->
    <Color x:Key="TitleColor" >#FFD34C4C</Color>
    <Color x:Key="SubTitleColor" >Red</Color>
    <Color x:Key="TextColor" >Black</Color>
    <Color x:Key="ButtonTextColor" >Red</Color>
    <Color x:Key="SelectedTextColor" >#FFFF9898</Color>
    <Color x:Key="DisabledTextColor" >#FFD34C4C</Color>

    <Color x:Key="BackgroundColor" >White</Color>
    <Color x:Key="BorderColor" >Darkgray</Color>
    <Color x:Key="ErrorBackgroundColor" >Red</Color>
    <Color x:Key="ErrorTextColor" >White</Color>
    
    <Color x:Key="RadioBorderColor" >Gray</Color>
    <Color x:Key="RadioHoverColor" >#FFFF9898</Color>
    <Color x:Key="RadioSelectedColor" >Red</Color>

    <Color x:Key="Player1Color" >Red</Color>
    <Color x:Key="Player2Color" >Blue</Color>

    <Color x:Key="Word1BackgroundColor">#00FFFFFF</Color>
    <Color x:Key="Word2BackgroundColor">#00FFFFFF</Color>
    <Color x:Key="Word3BackgroundColor">#00FFFFFF</Color>
    <Color x:Key="Word4BackgroundColor">#00FFFFFF</Color>
    <Color x:Key="Word5BackgroundColor">#00FFFFFF</Color>

    <Color x:Key="Word1TextColor" >#FFFF0000</Color>
    <Color x:Key="Word2TextColor" >#FF0064C9</Color>
    <Color x:Key="Word3TextColor" >#FFFFB900</Color>
    <Color x:Key="Word4TextColor" >#FF2FB910</Color>
    <Color x:Key="Word5TextColor" >#FF6E30F3</Color>

    <Color x:Key="Word1Color" >#FFFF0000</Color>
    <Color x:Key="Word2Color" >#FF0064C9</Color>
    <Color x:Key="Word3Color" >#FFFFB900</Color>
    <Color x:Key="Word4Color" >#FF2FB910</Color>
    <Color x:Key="Word5Color" >#FF6E30F3</Color>
    
    <Color x:Key="WinsColor" >Green</Color>
    <Color x:Key="LoseColor" >Red</Color>
    <Color x:Key="EqualityColor" >Orange</Color>
    
    <SolidColorBrush x:Key="Word1BackgroundBrush" Color="{DynamicResource ResourceKey=Word1BackgroundColor}"/>
    <SolidColorBrush x:Key="Word2BackgroundBrush" Color="{DynamicResource ResourceKey=Word2BackgroundColor}"/>
    <SolidColorBrush x:Key="Word3BackgroundBrush" Color="{DynamicResource ResourceKey=Word3BackgroundColor}"/>
    <SolidColorBrush x:Key="Word4BackgroundBrush" Color="{DynamicResource ResourceKey=Word4BackgroundColor}"/>
    <SolidColorBrush x:Key="Word5BackgroundBrush" Color="{DynamicResource ResourceKey=Word5BackgroundColor}"/>
    
    <!--Textblocks-->
    <SolidColorBrush x:Key="TitreBrush" Color="{DynamicResource ResourceKey=TitleColor}"/>
    
    <Style x:Key="Titre" TargetType="{x:Type TextBlock}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
		<Setter Property="TextWrapping" Value="NoWrap"/>
		<Setter Property="TextTrimming" Value="None"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=TitleSize}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}"/>
        <Setter Property="Foreground" Value="{DynamicResource TitreBrush}"/>
    </Style>

    <SolidColorBrush x:Key="SousTitreBrush" Color="{DynamicResource ResourceKey=SubTitleColor}" />

    <Style x:Key="SousTitre" TargetType="{x:Type TextBlock}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
		<Setter Property="TextWrapping" Value="NoWrap"/>
		<Setter Property="TextTrimming" Value="None"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=SubTitleSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource SousTitreBrush}"/>
    </Style>

    <SolidColorBrush x:Key="TexteBrush" Color="{DynamicResource ResourceKey=TextColor}" />

    <Style x:Key="Texte" TargetType="{x:Type TextBlock}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="TextWrapping" Value="NoWrap"/>
		<Setter Property="TextTrimming" Value="None"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=TextSize}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=LightFont}"/>
        <Setter Property="Foreground" Value="{DynamicResource TexteBrush}"/>
    </Style>

    <SolidColorBrush x:Key="TexteImportantBrush" Color="{DynamicResource ResourceKey=TextColor}" />

    <Style x:Key="TexteImportant" TargetType="{x:Type TextBlock}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="TextWrapping" Value="NoWrap"/>
        <Setter Property="TextTrimming" Value="None"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=TextSize}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=BoldFont}"/>
        <Setter Property="Foreground" Value="{DynamicResource TexteImportantBrush}"/>
    </Style>

    <SolidColorBrush x:Key="Word1Brush" Color="{DynamicResource ResourceKey=Word1Color}"/>

    <Style x:Key="Word1Text" BasedOn="{StaticResource Titre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word1Brush}"/>
    </Style>

    <SolidColorBrush x:Key="Word2Brush" Color="{DynamicResource ResourceKey=Word2Color}" />

    <Style x:Key="Word2Text" BasedOn="{StaticResource Titre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word2Brush}"/>
    </Style>

    <SolidColorBrush x:Key="Word3Brush" Color="{DynamicResource ResourceKey=Word3Color}" />

    <Style x:Key="Word3Text" BasedOn="{StaticResource Titre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word3Brush}"/>
    </Style>

    <SolidColorBrush x:Key="Word4Brush" Color="{DynamicResource ResourceKey=Word4Color}" />

    <Style x:Key="Word4Text" BasedOn="{StaticResource Titre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word4Brush}"/>
    </Style>

    <SolidColorBrush x:Key="Word5Brush" Color="{DynamicResource ResourceKey=Word5Color}" />

    <Style x:Key="Word5Text" BasedOn="{StaticResource Titre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word5Brush}"/>
    </Style>

    <SolidColorBrush x:Key="Player1Brush" Color="{DynamicResource ResourceKey=Player1Color}"/>

    <Style x:Key="Player1Text" BasedOn="{StaticResource SousTitre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=PlayerTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Player1Brush}"/>
    </Style>

    <SolidColorBrush x:Key="Player2Brush" Color="{DynamicResource ResourceKey=Player2Color}" />

    <Style x:Key="Player2Text" BasedOn="{StaticResource SousTitre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=PlayerTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Player2Brush}"/>
    </Style>

    <SolidColorBrush x:Key="WinsBrush" Color="{DynamicResource ResourceKey=WinsColor}" />

    <Style x:Key="WinsText" BasedOn="{StaticResource Titre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=ResultTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=WinsBrush}"/>
    </Style>

    <SolidColorBrush x:Key="LoseBrush" Color="{DynamicResource ResourceKey=LoseColor}" />

    <Style x:Key="LoseText" BasedOn="{StaticResource Titre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=ResultTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=LoseBrush}"/>
    </Style>

    <SolidColorBrush x:Key="EqualityBrush" Color="{DynamicResource ResourceKey=EqualityColor}"/>

    <Style x:Key="EqualityText" BasedOn="{StaticResource Titre}" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=ResultTextSize}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=EqualityBrush}"/>
    </Style>

    <!--TextBoxs-->
    <SolidColorBrush x:Key="TextBoxTextBrush" Color="{DynamicResource ResourceKey=TextColor}" />
    <SolidColorBrush x:Key="TextBoxBorderBrush" Color="{DynamicResource ResourceKey=BorderColor}" />
    <SolidColorBrush x:Key="TextBoxBackgroundBrush" Color="{DynamicResource ResourceKey=BackgroundColor}" />
    <SolidColorBrush x:Key="TextBoxErrorBackgroundBrush" Color="{DynamicResource ResourceKey=ErrorBackgroundColor}" />
    <SolidColorBrush x:Key="TextBoxErrorTextBrush" Color="{DynamicResource ResourceKey=ErrorTextColor}" />

    <ControlTemplate x:Key="ValidationToolTipTemplate">
        <Grid x:Name="Root" Margin="5,0" RenderTransformOrigin="0,0" Opacity="0">
            <Grid.RenderTransform>
                <TranslateTransform x:Name="xform" X="-25"/>
            </Grid.RenderTransform>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="OpenStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0"/>
                        <VisualTransition To="Open" GeneratedDuration="0:0:0.2">
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="xform" Storyboard.TargetProperty="X" To="0" Duration="0:0:0.2">
                                    <DoubleAnimation.EasingFunction>
                                        <BackEase Amplitude=".3" EasingMode="EaseOut"/>
                                    </DoubleAnimation.EasingFunction>
                                </DoubleAnimation>
                                <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"/>
                            </Storyboard>
                        </VisualTransition>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Closed">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="0" Duration="0"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Open">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="xform" Storyboard.TargetProperty="X" To="0" Duration="0"/>
                            <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>

            <Border Margin="4,4,-4,-4" Background="#052A2E31" CornerRadius="5"/>
            <Border Margin="3,3,-3,-3" Background="#152A2E31" CornerRadius="4"/>
            <Border Margin="2,2,-2,-2" Background="#252A2E31" CornerRadius="3"/>
            <Border Margin="1,1,-1,-1" Background="#352A2E31" CornerRadius="2"/>

            <Border Background="{DynamicResource ResourceKey=TextBoxErrorBackgroundBrush}" CornerRadius="2"/>
            <Border CornerRadius="2">
                <TextBlock UseLayoutRounding="false" Margin="8,4,8,4" MaxWidth="250" TextWrapping="Wrap"
                           Foreground="{DynamicResource ResourceKey=TextBoxErrorTextBrush}"
                           Text="{Binding (Validation.Errors)[0].ErrorContent}"/>
            </Border>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="TextBoxTemplate" TargetType="{x:Type TextBox}" >
        <Grid>
            <Grid.Resources>
                <Storyboard x:Key="DisabledStoryboard" >
                    <DoubleAnimation Storyboard.TargetName="Border" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="0" Duration="0" />
                </Storyboard>
                <Storyboard x:Key="InvalidUnfocusedStoryboard">
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0">
                            <DiscreteObjectKeyFrame.Value>
                                <Visibility>Visible</Visibility>
                            </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
                <Storyboard x:Key="InvalidFocused">
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                        <DiscreteObjectKeyFrame KeyTime="0">
                            <DiscreteObjectKeyFrame.Value>
                                <Visibility>Visible</Visibility>
                            </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" 
                                                   Storyboard.TargetProperty="IsOpen">
                        <DiscreteObjectKeyFrame KeyTime="0">
                            <DiscreteObjectKeyFrame.Value>
                                <sys:Boolean>True</sys:Boolean>
                            </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </Grid.Resources>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates" >
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver" />
                    <VisualState x:Name="Disabled" Storyboard="{StaticResource ResourceKey=DisabledStoryboard}" />
                    <VisualState x:Name="ReadOnly" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused" />
                    <VisualState x:Name="Unfocused" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="ValidationStates">
                    <VisualState x:Name="Valid"/>
                    <VisualState x:Name="InvalidUnfocused" Storyboard="{StaticResource ResourceKey=InvalidUnfocusedStoryboard}" />
                    <VisualState x:Name="InvalidFocused" Storyboard="{StaticResource ResourceKey=InvalidFocused}" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
            <ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}" BorderThickness="0" IsTabStop="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            <Border x:Name="ValidationErrorElement" BorderThickness="1" CornerRadius="1" BorderBrush="{DynamicResource ResourceKey=TextBoxErrorBackgroundBrush}" Visibility="Collapsed">
                <ToolTipService.ToolTip>
                    <ToolTip x:Name="validationTooltip" Placement="Right" 
                             Template="{DynamicResource ValidationToolTipTemplate}"
                             PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                             DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"/>
                </ToolTipService.ToolTip>
                <Grid Width="12" Height="12" HorizontalAlignment="Right" Margin="1,-4,-4,0" VerticalAlignment="Top" Background="Transparent">
                    <Path Margin="1,3,0,0" Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" Fill="{DynamicResource ResourceKey=TextBoxErrorBackgroundBrush}"/>
                    <Path Margin="1,3,0,0" Data="M 0,0 L2,0 L 8,6 L8,8" Fill="{DynamicResource ResourceKey=TextBoxBackgroundBrush}"/>
                </Grid>
            </Border>
        </Grid>
    </ControlTemplate>

    <Style x:Key="TextBox" TargetType="{x:Type TextBox}" >
        <!--<Setter Property="OverridesDefaultStyle" Value="True" />-->
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=LightFont}" />
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=TextSize}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey=TextBoxBorderBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=TextBoxTextBrush}" />
        <Setter Property="Background" Value="{DynamicResource ResourceKey=TextBoxBackgroundBrush}" />
        <Setter Property="Template" Value="{DynamicResource ResourceKey=TextBoxTemplate}" />
    </Style>

    <SolidColorBrush x:Key="Word1TextBrush" Color="{DynamicResource ResourceKey=Word1TextColor}" />

    <Style x:Key="Word1TextBox" BasedOn="{StaticResource TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word1TextBrush}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
    </Style>

    <SolidColorBrush x:Key="Word2TextBrush" Color="{DynamicResource ResourceKey=Word2TextColor}" />

    <Style x:Key="Word2TextBox" BasedOn="{StaticResource TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word2TextBrush}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
    </Style>

    <SolidColorBrush x:Key="Word3TextBrush" Color="{DynamicResource ResourceKey=Word3TextColor}" />

    <Style x:Key="Word3TextBox" BasedOn="{StaticResource TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word3TextBrush}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
    </Style>

    <SolidColorBrush x:Key="Word4TextBrush" Color="{DynamicResource ResourceKey=Word4TextColor}" />

    <Style x:Key="Word4TextBox" BasedOn="{StaticResource TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word4TextBrush}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
    </Style>

    <SolidColorBrush x:Key="Word5TextBrush" Color="{DynamicResource ResourceKey=Word5TextColor}" />

    <Style x:Key="Word5TextBox" BasedOn="{StaticResource TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=Word5TextBrush}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=WordTextSize}"/>
    </Style>

    <!--Button-->
    <SolidColorBrush x:Key="ButtonTextBrush" Color="{DynamicResource ResourceKey=ButtonTextColor}" />
    <SolidColorBrush x:Key="ButtonSelectedTextBrush" Color="{DynamicResource ResourceKey=SelectedTextColor}" />
    <SolidColorBrush x:Key="ButtonDisabledTextBrush" Color="{DynamicResource ResourceKey=DisabledTextColor}" />

    <ControlTemplate x:Key="ButtonTemplate" TargetType="{x:Type ButtonBase}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="MouseOverStoryboard" >
                <DoubleAnimation Storyboard.TargetName="ContentHostSelected" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
            </Storyboard>
            <Storyboard x:Key="DisabledStoryboard" >
                <DoubleAnimation Storyboard.TargetName="ContentHostDisabled" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver" Storyboard="{StaticResource MouseOverStoryboard}" />
                    <VisualState x:Name="Disabled" Storyboard="{StaticResource DisabledStoryboard}" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <ContentPresenter x:Name="ContentHost"
                              Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" 
                              TextBlock.Foreground="{TemplateBinding Foreground}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            <ContentPresenter x:Name="ContentHostSelected" Opacity="0"
                              Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" 
                              RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                              TextBlock.Foreground="{DynamicResource ButtonSelectedTextBrush}" />
            <ContentPresenter x:Name="ContentHostDisabled" Opacity="0"
                              Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" 
                              RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                              TextBlock.Foreground="{DynamicResource ButtonDisabledTextBrush}" />
        </Grid>
    </ControlTemplate>

    <Style x:Key="Button" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Foreground" Value="{DynamicResource ButtonTextBrush}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}"/>
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=ButtonTextSize}"/>
        <Setter Property="Template" Value="{DynamicResource ButtonTemplate}" />
    </Style>

    <!--BackButton-->
    <SolidColorBrush x:Key="BackButtonTextBrush" Color="{DynamicResource ResourceKey=ButtonTextColor}" />
    <SolidColorBrush x:Key="BackButtonSelectedTextBrush" Color="{DynamicResource ResourceKey=SelectedTextColor}" />

    <ControlTemplate x:Key="BackButtonTemplate" TargetType="{x:Type Button}" >
        <Grid>
            <Grid.Resources>
                <Storyboard x:Key="MouseOverStoryboard" >
                    <DoubleAnimation Storyboard.TargetName="SelectedEllipseBox" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
                    <DoubleAnimation Storyboard.TargetName="SelectedArrayBox" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
                </Storyboard>
            </Grid.Resources>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates" >
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver" Storyboard="{StaticResource MouseOverStoryboard}" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="2*" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="2*" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Viewbox Grid.RowSpan="3" Grid.ColumnSpan="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                <Ellipse Stretch="Uniform" Fill="Transparent" Width="24" Height="24" StrokeThickness="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                     Stroke="{TemplateBinding BorderBrush}" />
            </Viewbox>
            <Viewbox Grid.Row="1" Grid.Column="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" >
                <Path VerticalAlignment="Center" Stretch="Uniform" HorizontalAlignment="Left"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                      Fill="{TemplateBinding BorderBrush}" 
                      Data="M 0,5 0,7 6,12 9,12 3,7 12,7 12,5 3,5 9,0 6,0 Z "/>
            </Viewbox>
            <Viewbox x:Name="SelectedEllipseBox" Grid.RowSpan="3" Grid.ColumnSpan="3" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                <Ellipse Grid.RowSpan="3" Width="24" Height="24"  StrokeThickness="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                         Stroke="{TemplateBinding Foreground}" />
            </Viewbox>
            <Viewbox x:Name="SelectedArrayBox" Grid.Row="1" Grid.Column="1" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" >
                <Path VerticalAlignment="Center" Stretch="Uniform" HorizontalAlignment="Left"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                      Fill="{TemplateBinding Foreground}" 
                      Data="M 0,5 0,7 6,12 9,12 3,7 12,7 12,5 3,5 9,0 6,0 Z "/>
            </Viewbox>
        </Grid>
    </ControlTemplate>

    <Style x:Key="BackButton" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey=BackButtonTextBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=BackButtonSelectedTextBrush}" />
        <Setter Property="Template" Value="{DynamicResource ResourceKey=BackButtonTemplate}" />
    </Style>

    <!--ToggleButton-->
    <SolidColorBrush x:Key="ToggleButtonTextBrush" Color="{DynamicResource ResourceKey=ButtonTextColor}" />
    <SolidColorBrush x:Key="ToggleButtonSelectedTextBrush" Color="{DynamicResource ResourceKey=SelectedTextColor}" />
    <SolidColorBrush x:Key="ToggleButtonCheckedTextBrush" Color="{DynamicResource ResourceKey=SelectedTextColor}" />
    <SolidColorBrush x:Key="ToggleButtonDisabledTextBrush" Color="{DynamicResource ResourceKey=DisabledTextColor}" />

    <ControlTemplate x:Key="ToggleButtonTemplate" TargetType="{x:Type ToggleButton}" >
        <Grid>
            <Grid.Resources>
                <Storyboard x:Key="MouseOverStoryboard" >
                    <DoubleAnimation Storyboard.TargetName="ContentHostSelected" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
                </Storyboard>
                <Storyboard x:Key="DisabledStoryboard" >
                    <DoubleAnimation Storyboard.TargetName="ContentHostDisabled" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
                </Storyboard>
                <Storyboard x:Key="CheckedStoryboard" >
                    <DoubleAnimation Storyboard.TargetName="ContentHostChecked" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
                </Storyboard>
            </Grid.Resources>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates" >
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver" Storyboard="{StaticResource ResourceKey=MouseOverStoryboard}" />
                    <VisualState x:Name="Disabled" Storyboard="{StaticResource ResourceKey=DisabledStoryboard}" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="CheckStates">
                    <VisualState x:Name="Checked" Storyboard="{StaticResource ResourceKey=CheckedStoryboard}" />
                    <VisualState x:Name="Unchecked" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <ContentPresenter x:Name="ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                              Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" 
                              TextBlock.Foreground="{TemplateBinding Foreground}" />
            <ContentPresenter x:Name="ContentHostChecked" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                              Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" 
                              TextBlock.Foreground="{DynamicResource ToggleButtonSelectedTextBrush}" />
            <ContentPresenter x:Name="ContentHostSelected" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                              Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" 
                              TextBlock.Foreground="{DynamicResource ToggleButtonCheckedTextBrush}" />
            <ContentPresenter x:Name="ContentHostDisabled" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                              Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" 
                              TextBlock.Foreground="{DynamicResource ToggleButtonDisabledTextBrush}" />
        </Grid>
    </ControlTemplate>

    <Style x:Key="ToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=ToggleButtonTextBrush}" />
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=NormalFont}" />
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=ButtonTextSize}"/>
        <Setter Property="Template" Value="{DynamicResource ResourceKey=ToggleButtonTemplate}" />
    </Style>

    <!--RadioButton-->
    <SolidColorBrush x:Key="RadioButtonTextBrush" Color="{DynamicResource ResourceKey=TextColor}" />
    <SolidColorBrush x:Key="RadioButtonBorderBrush" Color="{DynamicResource ResourceKey=RadioBorderColor}" />
    <SolidColorBrush x:Key="RadioButtonHoverBrush" Color="{DynamicResource ResourceKey=RadioHoverColor}" />
    <SolidColorBrush x:Key="RadioButtonSelectedBrush" Color="{DynamicResource ResourceKey=RadioSelectedColor}" />
    
    <ControlTemplate x:Key="RadioButtonTemplate" TargetType="{x:Type RadioButton}">
        <Grid>
            <Grid.Resources>
                <Storyboard x:Key="MouseOverStoryboard" >
                    <DoubleAnimation Storyboard.TargetName="HoveredCircle" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
                </Storyboard>
                <Storyboard x:Key="CheckedStoryboard" >
                    <DoubleAnimation Storyboard.TargetName="SelectedCircle" 
                                     Storyboard.TargetProperty="(UIElement.Opacity)" 
                                     To="1" Duration="0" />
                </Storyboard>
            </Grid.Resources>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates" >
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver" Storyboard="{StaticResource ResourceKey=MouseOverStoryboard}" />
                    <VisualState x:Name="Disabled" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="CheckStates" >
                    <VisualState x:Name="Checked" Storyboard="{StaticResource ResourceKey=CheckedStoryboard}" />
                    <VisualState x:Name="Unchecked" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid Width="10" Height="10" VerticalAlignment="Center" >
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="2*" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Ellipse Grid.RowSpan="3" Grid.ColumnSpan="3" Stretch="Uniform" StrokeThickness="0.5" Fill="Transparent" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                     Stroke="{DynamicResource RadioButtonBorderBrush}" />
                <Ellipse x:Name="HoveredCircle" Opacity="0" Grid.Row="1" Grid.Column="1" Stretch="Uniform"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                         Fill="{DynamicResource RadioButtonHoverBrush}" />
                <Ellipse x:Name="SelectedCircle" Opacity="0" Grid.Row="1" Grid.Column="1" Stretch="Uniform"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                         Fill="{DynamicResource RadioButtonSelectedBrush}" />
            </Grid>
            <ContentPresenter x:Name="PART_ContentHost" Margin="5,0,0,0" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                              Grid.Column="1" IsHitTestVisible="False" />
        </Grid>
    </ControlTemplate>

    <Style x:Key="RadioButton" TargetType="{x:Type RadioButton}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="FontSize" Value="{DynamicResource ResourceKey=TextSize}"/>
        <Setter Property="FontFamily" Value="{DynamicResource ResourceKey=LightFont}"/>
        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=RadioButtonTextBrush}" />
        <Setter Property="Template" Value="{DynamicResource ResourceKey=RadioButtonTemplate}" />
    </Style>
    
    <!--AnimatedContentControl-->
    <ControlTemplate x:Key="AnimatedContentControlTemplate" TargetType="{x:Type ctrl:AnimatedContentControl}" >
        <ControlTemplate.Resources>
            <Storyboard x:Key="ContentChangedStoryboard">
                <DoubleAnimation Storyboard.TargetName="ContentChangedTransform" Storyboard.TargetProperty="X"
                                 From="-24" To="0" Duration="0:0:0.33" />
                <DoubleAnimation Storyboard.TargetName="ContentHost" Storyboard.TargetProperty="Opacity"
                                 From="0" To="1" Duration="0:0:0.33" />
            </Storyboard>
            </ControlTemplate.Resources>
        <ContentPresenter x:Name="ContentHost" RenderTransformOrigin="0,0" 
                          Margin="{TemplateBinding Padding}"
                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" >
            <ContentPresenter.RenderTransform>
                <TranslateTransform x:Name="ContentChangedTransform" />
            </ContentPresenter.RenderTransform>
        </ContentPresenter>
        <ControlTemplate.Triggers>
            <EventTrigger RoutedEvent="ctrl:AnimatedContentControl.ContentChanged">
            	<BeginStoryboard Storyboard="{StaticResource ResourceKey=ContentChangedStoryboard}" />
            </EventTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    
    <Style TargetType="{x:Type ctrl:AnimatedContentControl}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template" Value="{DynamicResource ResourceKey=AnimatedContentControlTemplate}" />
    </Style>
	
	<!--Busy Indicator-->	
	<ControlTemplate x:Key="ProgressBarTemplate" TargetType="{x:Type ProgressBar}">
		<ControlTemplate.Resources>
			<SolidColorBrush x:Key="StrokeBrush" Color="#FF347E86" />
			<LinearGradientBrush x:Key="FillBrush" EndPoint="0.5,1" StartPoint="0.5,0">
				<GradientStop Color="#FF21ECE1" Offset="0"/>
				<GradientStop Color="#FFC6DEE5" Offset="1"/>
				<GradientStop Color="#FF2E7661" Offset="0.526"/>
				<GradientStop Color="#FF347E7E" Offset="0.978"/>
            </LinearGradientBrush>
            <Storyboard x:Key="IndeterminateStoryboard" RepeatBehavior="Forever" >
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Rotation"
                                               Storyboard.TargetProperty="Angle" >
                    <EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="359"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid x:Name="mainGrid" Width="30" Height="30" RenderTransformOrigin="0.5,0.5">
			<Grid.RowDefinitions>
				<RowDefinition Height="0.2*"/>
				<RowDefinition Height="0.6*"/>
				<RowDefinition Height="0.2*"/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="0.2*"/>
				<ColumnDefinition Width="0.6*"/>
				<ColumnDefinition Width="0.2*"/>
			</Grid.ColumnDefinitions>
			<VisualStateManager.VisualStateGroups>
				<VisualStateGroup x:Name="CommonStates">
					<VisualState x:Name="Determinate" />
					<VisualState x:Name="Indeterminate" Storyboard="{StaticResource ResourceKey=IndeterminateStoryboard}" />
				</VisualStateGroup>
			</VisualStateManager.VisualStateGroups>
            <Grid.RenderTransform>
                <RotateTransform x:Name="Rotation" />
            </Grid.RenderTransform>
			<Rectangle x:Name="PART_Track" Visibility="Collapsed" Grid.ColumnSpan="3" Grid.RowSpan="3" />
			<Decorator x:Name="PART_Indicator" Visibility="Collapsed" Grid.ColumnSpan="3" Grid.RowSpan="3" />
			<Rectangle x:Name="PART_GlowRect" Visibility="Collapsed" Grid.ColumnSpan="3" Grid.RowSpan="3" />
			<Ellipse StrokeThickness="0.3
			" Stroke="{DynamicResource ResourceKey=StrokeBrush}" Fill="{DynamicResource FillBrush}"
					 Grid.ColumnSpan="3" Grid.RowSpan="3" RenderTransformOrigin="0.5,0.5" >
				<Ellipse.RenderTransform>
					<TransformGroup>
						<ScaleTransform/>
						<SkewTransform/>
						<RotateTransform Angle="-55"/>
						<TranslateTransform/>
					</TransformGroup>
				</Ellipse.RenderTransform>
				<Ellipse.OpacityMask>
					<RadialGradientBrush>
						<GradientStop Color="#00000000" Offset="0.58"/>
						<GradientStop Color="White" Offset="0.600"/>
						<GradientStop Color="White" Offset="1"/>
					</RadialGradientBrush>
				</Ellipse.OpacityMask>
			</Ellipse>
			<Ellipse Grid.Row="1" Grid.Column="1" StrokeThickness="0.3" Stroke="{DynamicResource ResourceKey=StrokeBrush}" />
			<Grid Grid.Column="1" >
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="0.2*" />
					<ColumnDefinition Width="0.6*" />
					<ColumnDefinition Width="0.2*" />
				</Grid.ColumnDefinitions>
				<Ellipse Grid.Column="1" >
					<Ellipse.Fill>
						<RadialGradientBrush>
							<GradientStop Offset="1" Color="#00472121"/>
							<GradientStop Color="#CCFFFFFF"/>
							<GradientStop Color="#CAFFFFFF" Offset="0.457"/>
						</RadialGradientBrush>
					</Ellipse.Fill>
				</Ellipse>
			</Grid>			
		</Grid>
	</ControlTemplate>

    <Style x:Key="ProgressBarStyle" TargetType="{x:Type ProgressBar}">
        <Setter Property="IsIndeterminate" Value="True"/>
        <Setter Property="Template" Value="{StaticResource ProgressBarTemplate}" />
    </Style>
	
	<ControlTemplate x:Key="BusyIndicatorTemplate" TargetType="{x:Type xctk:BusyIndicator}">
		<Grid>
			<VisualStateManager.VisualStateGroups>
				<VisualStateGroup x:Name="VisibilityStates">
					<VisualState x:Name="Hidden">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="busycontent">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<Visibility>Collapsed</Visibility>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
							<ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="overlay">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<Visibility>Collapsed</Visibility>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
					<VisualState x:Name="Visible">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="busycontent">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<Visibility>Visible</Visibility>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
							<ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="overlay">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<Visibility>Visible</Visibility>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
				</VisualStateGroup>
				<VisualStateGroup x:Name="BusyStatusStates">
					<VisualState x:Name="Idle">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.IsEnabled)" Storyboard.TargetName="content">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<sys:Boolean>True</sys:Boolean>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
					<VisualState x:Name="Busy">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.001" Storyboard.TargetProperty="(UIElement.IsEnabled)" Storyboard.TargetName="content">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<sys:Boolean>False</sys:Boolean>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
				</VisualStateGroup>
			</VisualStateManager.VisualStateGroups>
			<ContentControl x:Name="content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Focusable="False" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="False" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
			<Rectangle x:Name="overlay" Style="{TemplateBinding OverlayStyle}"/>
			<ContentPresenter x:Name="busycontent">
				<ContentPresenter.Content>
					<ProgressBar Style="{TemplateBinding ProgressBarStyle}"/>
				</ContentPresenter.Content>
			</ContentPresenter>
		</Grid>
	</ControlTemplate>
				
	<Style x:Key="BusyIndicatorStyle" TargetType="{x:Type xctk:BusyIndicator}">
		<Setter Property="IsTabStop" Value="False"/>
		<Setter Property="Focusable" Value="False"/>
		<Setter Property="OverlayStyle">
			<Setter.Value>
				<Style TargetType="{x:Type Rectangle}">
					<Setter Property="Fill" Value="White"/>
					<Setter Property="Opacity" Value="0.5"/>
				</Style>
			</Setter.Value>
		</Setter>
        <Setter Property="ProgressBarStyle" Value="{DynamicResource ResourceKey=ProgressBarStyle}" />
		<Setter Property="DisplayAfter" Value="0:0:0.1"/>
		<Setter Property="HorizontalAlignment" Value="Stretch"/>
		<Setter Property="VerticalAlignment" Value="Stretch"/>
		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
		<Setter Property="VerticalContentAlignment" Value="Stretch"/>
		<Setter Property="Template" Value="{DynamicResource ResourceKey=BusyIndicatorTemplate}" />
	</Style>
    
</ResourceDictionary>